package com.wangwei.authoritySystem.controller;

import com.wangwei.authoritySystem.common.Result;
import com.wangwei.authoritySystem.pojo.User;
import com.wangwei.authoritySystem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/user")
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("/index")
    public Object index(){
        User user = userService.getById(1L);
        return Result.success(user) ;
    }
    @GetMapping("/listAll")
    public Result listAll(){
        return Result.success(userService.list());
    }
}
